package com.zero.controller;

import com.zero.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 创建订单，并返回订单号
     * @param goodsId 商品id
     * @param count 购买数量
     * @return 订单创建结果
     */
    @RequestMapping("/create/{goodsId}/{count}")
    public String createOrder(@PathVariable("goodsId") int goodsId, @PathVariable("count") int count) {
        return orderService.createOrder(goodsId, count);
    }
}
